package com.lenovo.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.lenovo.dao.BaseDAO;
import com.lenovo.model.GTmallComment;
import com.lenovo.service.TmallService;
@Repository
public class TmallServiceImpl implements TmallService {

	@Resource
	private BaseDAO dao ;
	@Override
	public boolean save(GTmallComment comment) {
		boolean status = false;
		try{
			dao.save(comment);
			status = true;
		}catch(Exception ex){
			ex.printStackTrace();
		}	
		return status;
	}

	@Override
	public Integer findCountByTag(String tagName) {
		String hql="select count(*) from GTmallComment where tagName='"+tagName+"'" ; 
		return dao.countQuery(hql);
	}

	@Override
	public Integer findCountByTable() {
		// TODO Auto-generated method stub
		return dao.countAll("GTmallComment");
	}

	@Override
	public List<GTmallComment> browse() {
		return dao.listAll("GTmallComment").subList(0, 20) ;
	}

}
